<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/common/includes.jsp" %>
<html>
 <head>
    <title> 销售订单完结</title>
    <!-- import css and js -->
	<%@ include file="/common/meta.jsp" %>
	<script src="${ctx}/js/ligerUI/js/plugins/ligerLayout.js" type="text/javascript"></script>
	<script src="${ctx}/js/jsp/comm.js" type="text/javascript"></script>
	<script type="text/javascript" src="${ctx}/js/jsp/xxkj/logic/sales.js"></script>
	<script type="text/javascript">
	var type ="${type}";
	var basic_Url="${ctx}/logic/sales";
	var basic_WUrl="logic/sales";
	var basic_Title="销售订单完结";
	var show_Width=880;
	var show_Hight=500;
	jQuery(document).ready(function() {
		//创建JQGRID表格
		
		//var grid = 
			$("#table1").ligerGrid({
	        columns: [
	                  { display: 'id', name: 'id', hide:true, width:1 },
	                  { display: '销售单号', name: 'zd001FormCode', width: 150 },
	                  { display: 'PI编号', name: 'zd002PiCode', width: 180},
	                  { display: '客户单位名称', name: 'zd006CustomerName', width: 200},
	                  { display: '单据状态', name: 'zd024Billstatus', width: 80,
	                	  render: function (item){               		 
	                		  var billStatus=item.zd024Billstatus;
	                		  if(billStatus=="PCSR_SAVE"){
	                			  return "<span style='color:red;'>草稿</span>";
	                		  }
	                		  if(billStatus=="PCSR_BACK"){
	                			  return "<span style='color:red;'>驳回</span>";
	                		  }
	                		  if(billStatus=="PCSR_SUBMIT"){
	                			  return "<span style='color:red;'>待财务审核</span>";
	                		  }
	                		  if(billStatus=="PCSR_AUDIT"){
	                			  return "<span style='color:red;'>待生产审核</span>";
	                		  }
	                		  if(billStatus=="PCSR_APPROVE"){
	                			  return "<span style='color:red;'>待生产</span>";
	                		  }
	                		  if(billStatus=="PCSR_IN"){
	                			  return "<span style='color:red;'>生产中</span>";
	                		  }
	                		  if(billStatus=="PCSR_END"){
	                			  return "<span style='color:red;'>生产完成</span>";
	                		  }
	                	  }
	                  },
	                  { display: '仓库状态', name: 'zd025WareStatus', width: 70,
	                    	  render: function (item){               		 
	                    		  var status=item.zd025WareStatus;
	                    		  if(status=="0"||status==null){
	                    			  return "<span style='color:red;'>未出库</span>";
	                    		  }
	                    		  if(status=="1"){
	                    			  return "<span style='color:red;'>部分出库</span>";
	                    		  }
	                    		  if(status=="2"){
	                    			  return "<span style='color:red;'>全部出库</span>";
	                    		  }
	                    	  }
	                  },
	                  { display: '业务员', name: 'zd022SalesMan', width: 100 },
	                  { display: '制单人', name: 'bizCreatorName', width: 100 },
	                  { display: '建单时间', name: 'bizCreatorDate', width: 100,
	                	  render: function (item){
	                		  var cdate=new Date(item.bizCreatorDate);
	                		  return formatDate(cdate,"yyyy-MM-dd");
	                	  }},
	                  { display: '备注', name: 'zd023Remark', width: 150 }
	                 ],  
	                      usePager: true,pageSize:15,pageSizeOptions :[10,15,20,30,40,50], 
	                      enabledSort:false,
	                      url : basic_Url+"/finishSaleBillsList.do",
	                      width: "100%", height:"98%", checkbox: true, rownumbers:true,     
	                      onDblClickRow : function (data, rowindex, rowobj){
	                    	  edittype(data);
	                      }
	     });
		$("#pageloading").hide();
	});

		function createSearch(){
			init(1,8,'100,100,100,100,100,100,100,100','10%');
			//第一行的数据
			addCommon(0,0,"lable","销售单号：");
			addCommon(0,1,"txtlike","zd001FormCode");
			addCommon(0,2,"lable","客户单位名称：");
			addCommon(0,3,"txtlike","zd006CustomerName");
			addCommon(0,4,"lable","制单人：");
			addCommon(0,5,"txtlike","bizCreatorName");
			addCommon(0,6,"lable","PI编号：");
			addCommon(0,7,"txtlike","zd002PiCode");
		}
		
		function searchAP(){
			multipleSearch("#table1",true,"",basic_Url+"/finishSaleBillsList.do");
		}
		document.onkeydown=keyListener;   
		function keyListener(e){   
		    e = e ? e : event;  
		    if(e.keyCode == 13){   
		    	searchAP();
		    }   
		}  
		
		
		//编辑
		function edittype(data){
			var url = basic_Url+"/finishSaleBillsItem.do?id="+data.id;
			ShowIframeDialog("operate","单据完结",url,show_Width,show_Hight);
		}
	</script>
	
  </head>
 <body style="padding:10px" onload="createSearch()">  
       <div id="layout1">
          <div class="panelBar">
	            <ul class="toolBar">
		            <li><a class="add" onclick="addtype()"><span>订单完结</span></a></li>
               </ul>
          </div>
          <div id="pageHeader" class="pageHeader">
               <div class="searchBar" id="multipleSearchDialog">
	                <table class="table" width="100%" id="searchHeader" >  
                        <tbody id="newbody">
                        </tbody>
 	                </table>
                    <div class="subBar">
			             <ul>
				             <li><div class="buttonActive"><div class="buttonContent"><button type="submit" id="btnSearch" onclick="searchAP()">查询</button></div></div></li>
				             <li><a class="button" onclick="clearSearch()"><span>重置</span></a></li>
			             </ul>
	                </div>
               </div>
          </div>
      </div>
      <div position="center" id="table1">
      </div>
      <div class="clear"></div>
    </body>
</html>